package com.zx.centers.socketservice.util;

import com.zx.centers.socketservice.dto.IMUser;
import com.zx.centers.socketservice.user.TUser;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class ChatUtil {
    public static List<IMUser> convertUsers(List<TUser> users){
        if(CollectionUtils.isEmpty(users)){
            return null;
        }

        List<IMUser> imUserList = new ArrayList<>();
        for (TUser tUser : users) {
            IMUser imUser = new IMUser(tUser.getUid(),tUser.getUname(),tUser.getUsex());
            imUserList.add(imUser);
        }
        return imUserList;
    }
}
